modules/media/meson.build: Export needed symbols on MSVC
authorChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 22 Jun 2018 17:53:32 +0000 (01:53 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Thu, 6 Dec 2018 09:07:33 +0000 (17:07 +0800)
We need to override _GLIB_EXTERN to export the required symbols for the
GIO module on Visual Studio, so that the media modules can be
successfully loaded.

modules/media/meson.build

index 860fe467e917c43cff235845a3a14b7774204a17..8a05ccb565e2c6df707beaa4158c134f2e0c5d9f 100644 (file)
@@ -23,6 +23,13 @@ endif
 media_subdir = 'gtk-4.0/@0@/media'.format(gtk_binary_version)
 media_install_dir = join_paths(get_option('libdir'), media_subdir)
 
+extra_c_args = ['-DGTK_COMPILATION']
+
+# Detect and set symbol visibility
+if cc.get_id() == 'msvc'
+  extra_c_args += ['-D_GLIB_EXTERN=__declspec (dllexport) extern']
+endif
+
 if media_backends.contains('ffmpeg')
   libavfilter_dep = dependency('libavfilter', version: '>= 6.47.100', required: true)
   libavformat_dep = dependency('libavformat', version: '>= 57.41.100', required: true)
@@ -34,9 +41,7 @@ if media_backends.contains('ffmpeg')
 
   shared_module('media-ffmpeg',
                 'gtkffmediafile.c',
-                c_args: [
-                  '-DGTK_COMPILATION'
-                ],
+                c_args: extra_c_args,
                 dependencies: [ libgtk_dep, ffmpeg_deps ],
                 install_dir: media_install_dir,
                 install : true)
@@ -50,9 +55,7 @@ if media_backends.contains('gstreamer')
                 'gtkgstmediafile.c',
                 'gtkgstpaintable.c',
                 'gtkgstsink.c',
-                c_args: [
-                  '-DGTK_COMPILATION'
-                ],
+                c_args: extra_c_args,
                 dependencies: [ libgtk_dep, gstplayer_dep ],
                 install_dir: media_install_dir,
                 install : true)